﻿<Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:VMDS_GUIClient_ViewModels="clr-namespace:VMDS.GUIClient.ViewModels" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:local="clr-namespace:VMDS.GUIClient.Views" x:Class="VMDS.GUIClient.Views.VmLibrary" 
      mc:Ignorable="d" 
      d:DesignHeight="496" d:DesignWidth="784"
	Title="VmLibrary" Width="Auto" Height="Auto">
	<Page.Resources>
	
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="AutoScrollListBoxDictionary.xaml"/>
				<ResourceDictionary Source="ResourceDictionary1.xaml"/>
			</ResourceDictionary.MergedDictionaries>
			<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
				<Setter Property="SnapsToDevicePixels" Value="true"/>
				<Setter Property="OverridesDefaultStyle" Value="true"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type ListBoxItem}">
							<Border  x:Name="Border" Padding="1" SnapsToDevicePixels="true">
								<ContentPresenter x:Name="contentPresenter" />
							</Border>
							<ControlTemplate.Triggers>
								<Trigger Property="Selector.IsSelected" Value="True">
									<Setter Property="OpacityMask" TargetName="contentPresenter" Value="{x:Null}"/>
									<Setter Property="BorderBrush" TargetName="Border" Value="#FFF5352B"/>
									<Setter Property="BorderThickness" TargetName="Border" Value="4"/>
								</Trigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			<Storyboard x:Key="OnSelected1">
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="listBox">
					<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
					<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.87"/>
				</DoubleAnimationUsingKeyFrames>
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="listBox">
					<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
					<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="2.045"/>
				</DoubleAnimationUsingKeyFrames>
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="listBox">
					<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
					<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-169"/>
				</DoubleAnimationUsingKeyFrames>
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="listBox">
					<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
					<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-33.156"/>
				</DoubleAnimationUsingKeyFrames>
				<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="listBox">
					<EasingColorKeyFrame KeyTime="0" Value="#3EAAD5EB"/>
					<EasingColorKeyFrame KeyTime="0:0:0.2" Value="#FF54B9ED"/>
				</ColorAnimationUsingKeyFrames>
			</Storyboard>
			<Storyboard x:Key="OnMouseLeave1">
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="listBox">
					<SplineDoubleKeyFrame KeyTime="0" Value="1"/>
				</DoubleAnimationUsingKeyFrames>
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="listBox">
					<SplineDoubleKeyFrame KeyTime="0" Value="1"/>
				</DoubleAnimationUsingKeyFrames>
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="listBox">
					<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
				</DoubleAnimationUsingKeyFrames>
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="listBox">
					<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
				</DoubleAnimationUsingKeyFrames>
				<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="listBox">
					<EasingColorKeyFrame KeyTime="0" Value="#FF54B9ED"/>
				</ColorAnimationUsingKeyFrames>
				<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="listBox">
					<EasingColorKeyFrame KeyTime="0:0:0.2" Value="#3EAAD5EB"/>
				</ColorAnimationUsingKeyFrames>
			</Storyboard>
			<System:Double x:Key="Double1">NaN</System:Double>
			<DataTemplate x:Key="DataTemplate1">
				<Grid d:DesignWidth="344" d:DesignHeight="64" Width="Auto" Height="75">
					<Grid.RowDefinitions>
						<RowDefinition Height="*"/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="0.333*"/>
						<ColumnDefinition Width="0.571*"/>
						<ColumnDefinition Width="0.096*"/>
					</Grid.ColumnDefinitions>
					<TextBlock Margin="8,0" TextWrapping="Wrap" Text="{Binding Name}" Grid.RowSpan="1" TextAlignment="Center" VerticalAlignment="Center" FontSize="18.667" FontWeight="Bold" Foreground="#FFF5F2EC"/>
					<ProgressBar Grid.Column="1" HorizontalAlignment="Stretch" Height="42.4" Margin="8,0" VerticalAlignment="Center" Value="{Binding Progress, Mode=OneWay}"/>
					<TextBlock Margin="26.217,0,24.216,0" TextWrapping="Wrap" Text="{Binding CurrentOperation}" Grid.RowSpan="1" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" Width="Auto" Height="Auto" FontSize="16" FontWeight="Bold" d:LayoutOverrides="GridBox" TextAlignment="Center" Foreground="#FF121111"/>
				</Grid>
			</DataTemplate>
		</ResourceDictionary>
	</Page.Resources>
	<Page.Triggers>
		<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="listBox">
			<BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="FocusManager.GotFocus" SourceName="listBox">
			<BeginStoryboard Storyboard="{StaticResource OnSelected1}"/>
		</EventTrigger>
	</Page.Triggers>
	<Page.DataContext>
		<VMDS_GUIClient_ViewModels:VmLibraryViewModel/>
	</Page.DataContext>
    <Page.CommandBindings>
    	<CommandBinding Command="NavigationCommands.GoToPage" Executed="GoToPageExecuteHandler" CanExecute="GoToPageCanExecuteHandler" />
    </Page.CommandBindings>
	<Grid Margin="0">
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="352"/>
    		<ColumnDefinition/>    		
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="0.014*"/>
    		<RowDefinition Height="0.786*"/>
			<RowDefinition Height="0.2*"/>
    	</Grid.RowDefinitions>
    	<ListBox Margin="8" Style="{DynamicResource ListBoxWithAutoScroll_Vertical}" Grid.Row="1" ItemsSource="{Binding VMs}" SelectedItem="{Binding CurrentVM}" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}" ToolTip="Список виртуальных машин"/>
    	<Rectangle Grid.Column="1" Margin="0" Grid.Row="1" Stroke="Black" Opacity="0.2">
    		<Rectangle.Effect>
    			<BlurEffect KernelType="Gaussian" Radius="20"/>
    		</Rectangle.Effect>
    		<Rectangle.Fill>
    			<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
    				<GradientStop Color="#FF189783" Offset="1"/>
    				<GradientStop Color="White"/>
    			</LinearGradientBrush>
    		</Rectangle.Fill>
    	</Rectangle>
    	<Grid Margin="10,10,10,8" Grid.Column="1" Grid.Row="1">
    		<Grid.RowDefinitions>
    			<RowDefinition Height="0.069*"/>
    			<RowDefinition Height="0.058*"/>
    			<RowDefinition Height="0.213*"/>
    			<RowDefinition Height="0.473*"/>
    			<RowDefinition Height="0.187*"/>
    		</Grid.RowDefinitions>
    		<Grid.ColumnDefinitions>
    			<ColumnDefinition Width="0.245*"/>
    			<ColumnDefinition Width="0.755*"/>
    		</Grid.ColumnDefinitions>
    		<Rectangle Margin="0" Grid.ColumnSpan="2" Stroke="#FF266BC8"/>
    		<TextBlock Margin="10,0,0,0" TextWrapping="Wrap" Text="Название" FontSize="18.667" TextAlignment="Justify"/>
    		<Rectangle Margin="0" Grid.Row="1" Grid.ColumnSpan="2"/>
    		<TextBlock Margin="10,0,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Предмет" FontSize="18.667" TextAlignment="Justify" Visibility="Hidden"/>
    		<Rectangle Margin="0" Grid.Row="2" Grid.ColumnSpan="2" Stroke="#FF266BC8"/>
    		<TextBlock HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="2" TextWrapping="Wrap" Text="Описание" VerticalAlignment="Center" FontSize="18.667" TextAlignment="Justify"/>
    		<Rectangle Margin="0" Grid.Row="3" Grid.ColumnSpan="2" Stroke="#FF266BC8"/>
    		<TextBlock Grid.Column="1" Margin="10,0,0,0" TextWrapping="Wrap" Text="{Binding CurrentVM.Vm.Name}" FontSize="18.667" FontStyle="Italic" FontWeight="Bold"/>
    		<TextBlock Grid.Column="1" Margin="10,0,0,0" TextWrapping="Wrap" Text="{Binding CurrentVM.Vm.Subject.Name}" FontSize="18.667" FontStyle="Italic" FontWeight="Bold" Grid.Row="1"/>
    		<ScrollViewer Margin="0,5,5,5" Grid.Row="2" Grid.Column="1">
    			<TextBlock Margin="0" Text="{Binding CurrentVM.Vm.Description}" FontSize="14.667" TextWrapping="Wrap" Width="279.9"/>
    		</ScrollViewer>
    		<StackPanel Margin="8" Grid.Row="4" Orientation="Horizontal" Grid.ColumnSpan="2" HorizontalAlignment="Center" d:LayoutOverrides="GridBox">
    			<Button Margin="0,2" Style="{DynamicResource DisabledButton}" Width="75.786" FontSize="16" Height="Auto" Command="{Binding SetupVm, Mode=OneWay}" ToolTip="Установка виртуальной машины на ваш компьютер">
    				<StackPanel Margin="0">
    					<Image Source="Images/setup.ico" Margin="0" Width="40"/>
    					<TextBlock TextWrapping="Wrap" Text="Установить" FontSize="12" Margin="0,-7,0,0" />
    				</StackPanel>
    			</Button>
    			<Button Margin="20,2,0,2" Style="{DynamicResource DisabledButton}" Width="66.422" FontSize="16" Height="Auto" Command="{Binding StartVm, Mode=OneWay}" ToolTip="Запуск виртуальной машины">
    				<StackPanel Margin="0">
    					<Image Source="Images/power_on.png" Margin="0" Width="40"/>
    					<TextBlock TextWrapping="Wrap" Text="Запустить" FontSize="12" Margin="0,-7,0,0" />
    				</StackPanel>
    			</Button>
    			<Button Margin="20,2,0,2" Style="{DynamicResource DisabledButton}" Width="59.02" FontSize="16" Height="Auto" HorizontalContentAlignment="Left" ToolTip="Экспорт виртуальной машины на ваш съемный носитель" IsEnabled="False">
    				<StackPanel Margin="0">
    					<Image Source="Images/usbdrive.png" Margin="0,2,0,0" Width="40"/>
    					<TextBlock TextWrapping="Wrap" Text="Экспорт" FontSize="12" Margin="0,-11,0,0" />
    				</StackPanel>
    			</Button>
    		</StackPanel>
    	</Grid>
    	<TextBlock Grid.Column="1" Height="21" Margin="0,0,0,23" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Bottom" Foreground="#FFF1F304" FontSize="16" FontWeight="Bold" TextAlignment="Center" HorizontalAlignment="Center" Text="{Binding LockMessage}" Background="#B6D034BC">
    		<TextBlock.Effect>
    			<DropShadowEffect/>
    		</TextBlock.Effect>
    	</TextBlock>
    	<ListBox x:Name="listBox" Margin="0,137.228,10,80.628" Grid.Row="1" Style="{DynamicResource ListBoxWithAutoScroll_Horizontal2}" ItemsSource="{Binding ScreenShots}" ItemTemplate="{DynamicResource ScreenShotTemplate}" Grid.Column="1" RenderTransformOrigin="0.5,0.5" Background="#3EAAD5EB" HorizontalAlignment="Right" MaxWidth="400" BorderBrush="Black" BorderThickness="2">
    		<ListBox.RenderTransform>
    			<TransformGroup>
    				<ScaleTransform/>
    				<SkewTransform/>
    				<RotateTransform/>
    				<TranslateTransform/>
    			</TransformGroup>
    		</ListBox.RenderTransform>
    	</ListBox>
    	<ListBox Margin="10,8,10,0" ItemTemplate="{DynamicResource DataTemplate1}" ItemsSource="{Binding Instance.Operations}" Background="{x:Null}" HorizontalContentAlignment="Stretch" Grid.Row="2" Grid.ColumnSpan="2" ItemContainerStyle="{DynamicResource CustomListBoxItem}">
    		<ListBox.DataContext>
    			<VMDS_GUIClient_ViewModels:OperationsViewModel/>
    		</ListBox.DataContext>
    	</ListBox>
		<local:StartModalDialog Margin="0" Grid.ColumnSpan="2" Grid.RowSpan="2" Visibility="Visible"/>
    </Grid>
</Page>
